#include<reg52.h>
#define uint unsigned int
uint code table1[]={0x01,0x02,0x04,0x08};
uint code table2[]={0x08,0x04,0x02,0x01};
sbit key1=P2^0;
sbit key2=P2^1;
void delay(uint z)
{
	int x,y;
	for(x=z;x>0;x--)
		for(y=110;y>0;y--);
}
void qudong()
{
	int i;
	char j=2;
	while(1)
	{
		if(key1==0)
		j=1;
		if(key2==0)
		j=0;
		if(j==1)
		{
			for(i=0;i<4;i++)
			{
				P1=table1[i];
				delay(8);
			}
		}
		if(j==0)
		{
			for(i=0;i<4;i++)
			{
				P1=table2[i];
				delay(8);
			}
		}
	}
}
void main()
{
	qudong();
}
